home *** CD-ROM | disk | FTP | other *** search
-
-
- 1 2 8 P R I N T S H O P T O F O N T
-
- Program and Text by Bob Markland
-
-
- The primary reason for selecting a C-128 over a C-64, aside from the
- extra memory, is the 80-column mode. And here at LOADSTAR 128 nearly every
- program is in the 80-column mode.
-
- As you no doubt know, the C-128 uses the text-oriented 8563 Video
- Display Controller chip (VDC) to display the 80-column screen. Besides
- allowing longer screen lines, its advantages include vivid colors,
- additional attributes, and the ability to display two fonts (512 different
- characters) simultaneously. And, unlike the VIC chip which stores
- characters in ROM, the VDC chip's character sets are addressable in place.
-
- But, alas, there is a down side -- the VDC chip is text-oriented. There
- is a limited bit-map mode, but the 640 x 400 pixels eat up nearly all of
- the 8563's available memory. Ordinarily only the background and one
- foreground color is available -- you can cut the bit-map by 1/4 and regain
- color control -- but in any event the character sets are gone.
-
- An experienced (or masochistic) M/L programmer can overcome these
- problems, but few have even attempted it. And no adequate solution is
- available from BASIC. So, many 80-column programs lack the visual
- enhancements common to C-64 programs.
-
- How about a compromise? What if you could easily display a smaller
- graphic anywhere on the screen?
-
- Print Shop Icons are an ideal source for small graphics. Existing
- images are plentiful or you can use The Print Shop Companion to draw just
- the graphic you want. LOADSTAR's COMPLEAT PRINT SHOP disks contain over
- 2600 Print Shop icons. You're sure to find an icon in this collection to
- fit your needs.
-
- Armed with a good idea for a program and an icon library you're almost
- ready to begin, except for two major impediments. Print Shop 3-block icons
- are stored in a format totally unlike any Commodore screen or font storage.
- And, on the 80-column screen, if icons were displayed at their normal 11
- byte width, they would be "squashed" horizontally. So a utility is needed
- to alter the format and double the width, and 128 PRINT SHOP TO FONT does
- just that.
-
-
- USING PRINT SHOP TO FONT
- ------------------------
-
- 128 PS TO FONT is a freestanding utility. You can write a program that
- uses only the utility and icons. However, it is also compatible with
- CONTROL80 and 128 RLE for more complex applications.
-
- First you must decide how you are going to make use of the PS icons. If
- your program will use only a few icons, you can store them on disk
- individually and BLOAD them as needed.
-
- When numerous icons are required you should bundle them into a single
- file. There are several ways to accomplish this, but here is the method I
- used for the demo:
-
- 1) With no program in memory, enter the built-in MONITOR and fill an area
- of memory with a known value, let's say, BB.
-
- F 02000 04000 BB
-
- then exit the monitor.
-
- 2) BLOAD all of your icons into successive areas of memory, 3 pages apart
- (768 bytes), from direct mode, as follows:
-
- BLOAD"Icon 1",B0,P8192
- BLOAD"Icon 2",B0,P8960
- etc.
-
- There are two reasons for spacing the icons on page boundaries. First,
- a PS icon is 11 characters wide and 6-1/2 characters high. 128 PS TO FONT
- uses the 44 bytes beyond each icon as a work area to account for the stray
- 1/2 character. Second, it is easier to keep track of the indexing for
- multiple icons.
-
- You could write a 3-line Q&D program to read the icon names from DATA
- statements, increment the load address with a variable, and complete the
- above process in one operation. But, unless you plan to make several icon
- files, it may not be worth the bother.
-
- 3) When all of your icons are in memory, enter the MONITOR again, and
- scan memory with the "M" command to find the ending address of the last
- icon plus one (+1). Note the address and exit the monitor.
-
- 4) BSAVE the icons as a single file using the following syntax, where
- "start" is the beginning address of the first icon and "end" is the address
- of the end of the last icon:
-
- BSAVE"FILENAME,B0,Pstart TO Pend+1
-
- Or, if you're comfortable with the monitor, you could save the icons as a
- single file inside the monitor, using hex numbers and the S (save)
- command.
-
- 5) If the icon file is relatively short you may wish to end the process
- at this point. Otherwise, use 128 RLE (Run Length Encoding) Packer/Unpacker
- to "PACK A FILE", thus creating a file which takes up less disk space and
- loads more quickly. Then include 128 RLE in your program to unpack the
- file.
-
- You are now ready to begin your program. There are six versions of 128
- PS TO FONT on disk and their file names indicate the necessary load
- address:
-
- 128 PS-FONT 0C00
- 128 PS-FONT 1300
- 128 PS-FONT 1C00
- 128 PS-FONT 2400
- 128 PS-FONT 3500
- 128 PS-FONT 3800
-
- If you absolutely need a version at a location not found above, you can
- use Jeff Jones' ML MOVER from LS 64 #156 to create versions almost anywhere
- you want.
-
- Use BLOAD to load 128 PS TO FONT into bank 0, where dv is the number of
- the active device:
-
- BLOAD"128 PS-FONT xxxx",B0,U(dv)
-
- The choice of which version to use depends upon what else you have
- going on. If 128 PS TO FONT is the only utility you will be using, $0C00 or
- $1300 are perhaps the best choices. You will notice the accompanying demo
- uses both CONTROL80 and 128-RLE so the $1C00 version is the one to use. The
- remaining versions are intended to nestle among the various incarnations of
- CONTROL80, custom fonts, etc. If you choose to move the start of BASIC to
- $4000, any of the higher versions may be used, with or without other
- utilities.
-
- FENDER'S NOTE: When I use CONTROL80, I invariably move the start of BASIC
- up to $4000 with the GRAPHIC1,1:GRAPHIC0:GRAPHIC5 sequence. I've never
- written a 128 mode BASIC program so large that I needed BASIC to start at
- the normal $1300, or even $1C00. So why not move BASIC up to $4000 and use
- that open area from the top of CONTROL80 to $4000 for buffers, ML routines,
- etc.?
-
- 128 PS TO FONT supports two different types of icon displays -- full-
- size and cropped. Full-size icons require 154 characters (22 x 7). As a
- result, only two different icons may be imbedded in the character sets. One
- in the upper portion of font 0 and the other in the upper portion of font
- 1.
-
- This not only limits the number of possibilities, but the 22 x 7 size
- doesn't space well on a 80 x 25 screen. Unless there is a critical need to
- display the entire icon, cropping is preferable.
-
- 128 PS TO FONT can automatically crop an icon for you. The utility
- trims 2 rows of pixels from the top and bottom of the image and 4 pixels
- from both the left and right sides. The resulting image is 20 x 6
- characters in size. You may wish to take this into consideration when you
- select your icons, and use Print Shop Companion to edit them beforehand.
-
- Sixteen cropped icons fit nicely on the screen and you can store three
- different icons simultaneously, still leaving 128 character definitions for
- text.
-
- Numerous arrangements are possible, depending upon the needs of your
- program. Some of the possibilities include:
-
- 1) Store one icon in the upper half of font 0 and another in the upper
- half of font 1. This leaves both uppercase and lowercase text intact.
-
- 2) Reverse the above process, leaving both reversed character sets
- available.
-
- 3) Store two icons in one font or the other. You then have one entire
- character set for text/graphics characters.
-
- 4) Store two icons in one or the other font and one in half of the
- remaining font. 128 text characters remain available in either normal or
- reverse.
-
- It is theoretically possible to store four icons at one time. However,
- doing so will corrupt any text characters on the screen and prevent further
- use of text until at least one font is restored with CONTROL80's FCOPY.
-
- While it is not necessary to include a custom font, if you plan to
- write a program for LOADSTAR it is not likely to be accepted without one.
- Include CONTROL80 in your program and FCOPY a custom font into place before
- using 128 PS TO FONT.
-
- You should also be aware that alterations to the fonts can cause a
- BASIC listing to look weird at best, unintelligible at worst. The trick is
- to enter FINIT in the immediate mode to restore normal fonts. You may even
- want to use a TRAP routine to automatically do a FINIT when you press STOP
- to edit your program.
-
- How and where you load the icon images depends upon what other
- utilities you may be using. If you are using single icons, use the same 3-
- block area of Bank 0 and load to it repeatedly. When CONTROL80 is in use
- memory becomes a little more scarce. Personally, I prefer to use Bank 1 for
- storage. Bank 1 is the bank BASIC uses for variable storage. Numeric
- variables and static strings are stored from $0400 upward and dynamic
- strings are stored from $FF00 downward. Unless your program uses a huge
- number of variables or you have somehow induced garbage collection problems
- (by creating a bunch of concatenated strings), a large section of memory in
- the middle of Bank 1 remains free.
-
- Once you have 128 PS TO FONT and at least one icon in place you are
- ready to display it. Everything is handled with one simple SYS command:
-
- SYSADDR:B,IA,F,P,C
-
- Because of the way BASIC 7.0 handles the SYS command you MUST include
- the colon (:) before the first parameter.
-
- SYSADDR - Is the starting ADDRess of the version of 128 PS TO FONT you
- are using.
-
- B - Is the Bank where your icon images reside (0 or 1).
-
- IA - This is the address of the icon you wish to transfer to a font. Note
- that this can be a variable or formula. When you have a series of icons in
- a single file, stored as explained above, you can address them with:
-
- Icon Address+768*Location Number
-
- F - Selects the Font into which you wish to imbed the icon (0 or 1):
-
- Font 0 - Uppercase/Graphics
- Font 1 - Lowercase
-
- P - Determines the Position within the selected font (0 or 1):
-
- 0 - Selects lower half - Normal
- 1 - Selects upper half - Reverse
-
- Note: If you select Normal for the cropped option, 1 is the only
- setting possible for Position, and the utility will force this condition if
- necessary.
-
- C - This option tells the utility to transfer a normal or Cropped image:
-
- 0 - Cropped
- 1 - Normal
-
- Compiler and M/L uses are also supported. Because compilers choke on
- the non-standard method used to get the parameters use this instead:
-
- POKEload address+551,BANK
- POKE176,low byte Icon Address
- POKE177,high byte Icon Address
- POKEload address+552,FONT
- POKEload address+553,POSITION
- POKEload address+554,CROP
- SYSADDR+3
-
- From a M/L program:
- lda bank
- sta load'addr+551
- lda <icon'address
- sta $b0
- lda >icon'address
- sta $b1
- lda font
- sta load'addr+552
- lda position
- sta load'addr+553
- lda crop
- sta load'addr+554
- jsr sys'addr+3
-
-
- You now have an icon in one of your fonts, but it is not yet displayed
- on the screen. To do this you must define a string.
-
- Now is probably a good time to print a copy of this text and run the
- PRINT SHOP TO FONT DEMO. After viewing the demo you can break out with
- STOP/RESTORE and more easily follow the logic.
-
-
- DISPLAYING ICONS
- ----------------
-
- There are several ways to define your print string, but I prefer to
- READ from DATA statements and concatenate one long string. All the
- important sections of the demo are REMmed so you can easily incorporate
- them into your own program.
-
- CR$ is for the display of cropped icons. It consists of the first 120
- CHR$ values as a font is laid out. The string is the same for both normal
- and reversed. The difference is accounted for when you print CR$.
-
- PRINTCHR$(146)CR$ - for an icon in position 0 (reverse off)
-
- PRINTCHR$(18)CR$ - for an icon in position 1 (reverse on)
-
- FL$ is for displaying FulL-size icons. It consists of the last 26
- characters from the first half of the font, a CHR$(18), and the 128
- characters from the second half of the font.
-
- You must also include CHR$(142) and CHR$(14) in the PRINT command
- depending upon whether the icon is in font 0 or 1. For example:
-
- PRINTCHR$(142)CHR$(18)CR$ - for an icon in font 0, position 1.
-
- This may sound a bit confusing at first, but after you LIST and examine
- the demo you will find it is quite easy.
-
- Another key element in displaying icons with a minimum of effort is the
- WINDOW command. You will notice in the above text, there is no provision
- for carriage returns (CHR$(13)) following each series of 20 or 22
- characters. There is a very good reason for this.
-
- Use the following syntax to define a window and display an icon in it:
-
- WINDOW TC,TR,TC+19,TR+5,[1]:
- PRINTCHR$(27)"M":COLOR5,CO:
- PRINTCHR$(142)CHR$(18)CR$
-
- TC = Top left Column
- TR = Top left Row
- [1] - Is optional and clears the window before printing
- CHR$(27)"M" - prevents the window from scrolling
- CO - Determines the color of the icon to be displayed
-
- To display full-size icons, simply use TC+21, TR+6 and FL$ in the above
- example.
-
- It is not necessary to use a window if you prefer not to. Instead, you
- can imbed CHR$(13)s in the appropriate places within the string.
-
- You can also use an array:
-
- CR$(1)="@ABCDEFGHIJKLMNOPQRS"
- CR$(2)= second line
- CR$(3)= third line
- etc.
-
- By calculating which characters make up the image you can also print
- color change commands and selected characters to produce a multi-color icon
- image.
-
- If you elect to use CONTROL80 in your program, in addition to custom
- fonts, you can use POST and an array to display an entire icon. Or you can
- use POST, BLOCK or FILL to achieve multi-color effects and flashing
- characters.
-
- The demo also illustrates how you can quickly change an icon image
- already on the screen. This is accomplished by simply transferring a
- different icon to the same area of the appropriate font.
-
- To create even larger images you can use Print Shop Companion to draw
- three icons which are a part of a larger graphic. Then link or stack the
- icons on screen to form a single large mural. On the other hand, in a game
- or puzzle, you could selectively display only a portion of an icon. For
- that matter you could draw a custom icon which has a different image in
- each quadrant. Then by displaying only a quarter of each icon with a PRINT
- statement you could have 12 different smaller images on the screen at
- once.
-
- With a little imagination and experimentation, there should be no limit
- to the effects you can create. You will surely think of numerous
- possibilities I haven't even considered.
-
- FT'S POSTMUMBLE: Is 128 PS TO FONT fast enough for animation? I remember
- making a demo for the C-64 version of PS TO FONT years ago and it
- "simulated" animation of Medusa, the snake-haired lady. I allowed the user
- to set the speed and found that the animation looked best at a less than
- maximum speed. So let us know, if you use this utility to attempt some
- "small-screen" animation, how it goes. I see 128 PS TO FONT as a tool
- begging for someone to use in a creative way. If you tackle animation,
- you'll still have all the hard work of making multiple copies of some PS
- icons, but at least the displaying will be painless, thanks to Bob
- Markland.
-
- \\\\\ R - Run RETURN - Menu \\\\\
-
-